<template>
    <el-container direction="vertical">
        <el-menu
                :default-active="menuActive"
                router
                mode="horizontal"
                popper-effect="dark"
                background-color="#ffffff"
                class="el-menu-demo"
                text-color="#7a80b4"
                active-text-color="#409eff"
        >
            <el-menu-item v-if="parseConfigFn(VITE_BUILD_CONFIG_SERVER)" index="/home/dataForward">
                <span>OTA配置</span>
            </el-menu-item>
        </el-menu>
        <el-main class="main">
            <router-view></router-view>
        </el-main>
        <div  class="color-[#7a80b4] absolute right-8 top-3 cursor-pointer" @click="logout">
            退出登录
        </div>
    </el-container>
</template>

<script setup lang="ts">
import {ref} from "vue";
import Router from "@/router";

const menuActive = ref("/");

const {VITE_BUILD_CONFIG_SERVER} = import.meta.env; //导入环境变量
const {VITE_BUILD_CONFIG_PARSE} = import.meta.env; //导入环境变量
const {VITE_BUILD_CONFIG_NTRIP} = import.meta.env; //导入环境变量
const {VITE_BUILD_CONFIG_COLLECT} = import.meta.env; //导入环境变量
const {VITE_BUILD_CONFIG_OTA} = import.meta.env; //导入环境变量
// debugger

const parseConfigFn = (target: string) => target.includes("true")
const logout = () => {
    localStorage.removeItem("sessionId");
    Router.replace({ name: "Login" });
}

</script>

<style scoped>


.header {
    display: flex;
    justify-content: center;
}

.el-menu-demo {
    height: 50px;
}

.main {
    height: calc(100vh - 50px);
    background-color: rgb(250, 250, 250);
}

.el-menu-item a {
    text-align: center;
}
</style>
